import request from '@/utils/request'
import qs from 'qs'

export function roleList() {
    return request({
        url: '/api/role/roleList.do',
        method: 'get'
    })
}

export function add(name, auth) {
    return request({
        url: '/api/role/add.do',
        method: 'post',
        data: qs.stringify({
            name,
            authorities: auth.join("-")
        })
    })
}

export function update(id, name, auth) {
    return request({
        url: '/api/role/update.do',
        method: 'post',
        data: qs.stringify({
            id,
            name,
            authorities: auth.join("-")
        })
    })
}

export function del(id) {
    return request({
        url: '/api/role/delete.do',
        method: 'get',
        params: {
            id
        }
    })
}

export function detail(id) {
    return request({
        url: '/api/role/detail.do',
        method: 'get',
        params: {
            id
        }
    })
}

export function permissionList() {
    return request({
        url: '/api/role/permissionList.do',
        method: 'get'
    })
} 